package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduHousehold.EduHouseholdKeyVO;
import com.jwsoft.manager.common.vo.eduHousehold.EduHouseholdQueryVO;
import com.jwsoft.manager.common.vo.eduHousehold.EduHouseholdVO;
import com.jwsoft.manager.common.vo.individuation.HouseHoldSaveVO;
import com.jwsoft.manager.core.integration.EduHouseholdIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 户籍信息表网关
 *
 * @author wangtao
 * @since 2022-12-02
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "户籍信息表", description = "户籍信息表")
public class EduHouseholdController {

    @Autowired
    public EduHouseholdIntegration eduHouseholdIntegration;

    @Operation(summary = "户籍信息表分页查询",description = "户籍信息表分页查询")
    @PostMapping(value = "/eduHousehold0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduHouseholdVO>> getList(@RequestBody @Validated EduHouseholdQueryVO vo) {
        return AppResponse.successData(eduHouseholdIntegration.getList(vo));
    }

    @Operation(summary = "户籍信息表根据主键查询详情",description = "户籍信息表根据主键查询详情")
    @PostMapping(value = "/eduHousehold0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseholdVO> getById(@RequestBody @Validated EduHouseholdKeyVO vo) {
        return AppResponse.successData(eduHouseholdIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍信息表新增",description = "户籍信息表新增")
    @PostMapping(value = "/eduHousehold0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseholdVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduHouseholdVO vo) {
        return AppResponse.successData(eduHouseholdIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍信息表修改",description = "户籍信息表修改")
    @PostMapping(value = "/eduHousehold0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseholdVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduHouseholdVO vo) {
        return AppResponse.successData(eduHouseholdIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍信息表删除",description = "户籍信息表删除")
    @PostMapping(value = "/eduHousehold0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduHouseholdKeyVO vo) {
        eduHouseholdIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍接口信息获取并保存", description = "户籍接口信息获取并保存")
        @PostMapping(value = "/eduHousehold0007", produces = "application/json;charset=UTF-8")
    public AppResponse saveHouseInterfaceData(@Validated @RequestBody HouseHoldSaveVO vo) {
        eduHouseholdIntegration.saveHouseHoldData(vo);
        return AppResponse.success();
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "家长端户籍接口信息获取并保存", description = "户籍接口信息获取并保存")
    @PostMapping(value = "/eduHousehold0008", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseholdVO> queryHouseHoldDataApp(@Validated @RequestBody HouseHoldSaveVO vo) {
        return AppResponse.successData(eduHouseholdIntegration.queryHouseHoldDataApp(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "大数据户籍信息分页查询",description = "大数据户籍信息分页查询")
    @PostMapping(value = "/eduHousehold0009", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduHouseholdVO>> queryBigDataHousehold(@RequestBody @Validated HouseHoldSaveVO vo) {
        return AppResponse.successData(eduHouseholdIntegration.queryBigDataHousehold(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "比对学生报名户籍信息",description = "比对学生报名户籍信息")
    @PostMapping(value = "/eduHousehold0010", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduHouseholdVO>> bdStudentHouseld(@RequestBody @Validated EduHouseholdQueryVO vo) {
        eduHouseholdIntegration.bdStudentHouseld(vo);
        return AppResponse.successMsg("比对成功！");
    }

}
